<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>startswith,endswith判断字符串是否以某字符开头结尾，返回true</title>
</head>

<body>
    <script>
        let str = 'fffkkkhh';
        console.log(str.startsWith('fff')); //true
        console.log(str.endsWith('hh')); //true
        console.log(str.startsWith('fh')); //false
    </script>
</body>

</html>